﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="forecastpost_add.aspx.cs" Inherits="forecastpost_add" ValidateRequest="false" MasterPageFile="~/APP_Master/MasterPage_Personal.master" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <link href="css/webstyle.css" rel="stylesheet" />
    <link href="App_Themes/css/webstyle.css" rel="stylesheet" />
    <script src="App_Themes/js/jiangjinjisuan/jquery-1.js" type="text/javascript"></script>

    <link href="kindeditor_a5/kindeditor-4.1.10/themes/default/default.css" rel="stylesheet" />
    <%--    <script src="kindeditor_a5/kindeditor-4.1.10/kindeditor.js" type="text/javascript" charset="utf-8"></script>--%>
    <script src="kindeditor_a5/kindeditor-4.1.10/kindeditor-min.js"></script>
    <script src="kindeditor_a5/kindeditor-4.1.10/lang/zh_CN.js" type="text/javascript"></script>


    <script type="text/javascript">
        KindEditor.ready(function (K) {
            editor = K.create('textarea[name="content"]', {
                filterMode: true,//是否开启过滤模式
                pasteType : 2,
                //cssPath: '/css/index.css'
                //cssPath: 'kindeditor_a5/kindeditor-4.1.10/plugins/code/prettify.css',
          
            });
        });
        //KindEditor.ready(function(K) {
        //    window.editor = K.create('#content');
        //});

        //var options = {
        //    cssPath: '/css/index.css',
        //    filterMode: true
        //};
        // K.create('textarea[name="content"]', options);
    </script>
    <script language="javascript" type="text/javascript">
        function init() {
            //if (!editor.designMode){editor.clickToolbar('source');}; 
            editor.sync();
            var post = document.getElementById("<%=postType.ClientID %>");
            var type = document.getElementById("<%=lotteryType.ClientID %>");
            var LotteryType = type.options[type.selectedIndex].value;
            var PostType = post.options[post.selectedIndex].value;
            var Title = document.getElementById("<%=title.ClientID %>").value;
            //var Content = $("#content").val();
            var Content =editor.html();
            if (Title.length == 0)
            {
                alert("文章标题不能为空！");
            }
            else if (Content.length == 0) {
                alert("预测内容不能为空！");
            }        
            else {
                $.ajax({
                    url: "/Ajax/LotteryData.ashx",
                    data: { t: 'FaBuYuCe', lotteryType: LotteryType, postType: PostType, title: Title, content: Content,id:<%=id%> },
                    type: "post",
                    dataType: "json",
                    success: function (data) {
                        if (data > 0) {
                            if(<%=id%>>0)
                            {
                                alert("修改成功！");
                            }
                            else
                            {
                                alert("发布成功！");
                            }                       
                            type.options[type.selectedIndex].value=1;
                            post.options[post.selectedIndex].value="预测推荐";
                            document.getElementById("<%=title.ClientID %>").value="";
                            KindEditor.instances[0].html("");
                            window.location.href="forecastpostmyself_list.aspx?u=<%=BLL.CMember.UserLoginInfo().Id %>";
                        }
                    }
                });
            }
    }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div class="jyc_r" style="height: 720px">
        <div class="jyc_r_title">
            <ul>
                <li class="jyc_r_t"><a href="forecastpost_add.aspx?u=<%=BLL.CMember.UserLoginInfo().Id %>" style="color: #fff;">发布预测</a></li>
                <li><a href="forecastpostmyself_list.aspx?u=<%=BLL.CMember.UserLoginInfo().Id %>">预测管理</a></li>
            </ul>
        </div>
        <table width="100%" border="0" cellspacing="0" cellpadding="0" style="line-height: 35px; font-size: 14px; color: #404040;">
            <tr>
                <td height="40px"></td>
            </tr>
            <tr>
                <td width="8%" height="60" align="left" valign="top">文章分类：</td>
                <td width="81%" align="left" valign="top">
                    <select name="select" id="lotteryType" class="fbyc_bd1" runat="server">
                        <option value="1">双色球</option>
                        <option value="2">大乐透</option>
                        <option value="5">福彩3D</option>
                        <%--  <option value="3">排列三</option>
                        <option value="4">排列五</option>
                        <option value="6">七星彩</option>
                        <option value="7">七乐彩</option>--%>
                    </select>
                    <select name="select" id="postType" class="fbyc_bd1" runat="server">
                        <option value="预测推荐">预测推荐</option>
                        <option value="投注技巧">投注技巧</option>
                        <option value="中奖故事">中奖故事</option>
                    </select></td>
                <td width="11%" align="left" valign="top">&nbsp;</td>
            </tr>
            <tr>
                <td height="60" align="left" valign="top">文章标题：</td>
                <td align="left" valign="top">
                    <input id="title" type="text" class="fbyc_bd" maxlength="50" runat="server"></td>
                <td align="left" valign="top">&nbsp;</td>
            </tr>
            <tr>
                <td height="305" align="left" valign="top">预测内容：</td>
                <td align="left" valign="top">
                    <textarea id="content" name="content" style="width: 750px; height: 300px;"><%=foreast %></textarea></td>
                <td align="left" valign="top">&nbsp;</td>
            </tr>
            <tr>
                <td colspan="3">&nbsp;</td>
            </tr>
            <tr>
                <td align="left" valign="top">&nbsp;</td>
                <td align="right" valign="top">
                    <input id="submit" type="button" value="确认提交" class="fbyc_btn" onclick="init();"></td>
                <td align="left" valign="top">&nbsp;</td>
            </tr>
        </table>
    </div>
    </div>
</asp:Content>
